package com.scau.classOnline.model;

public class RespEntity {

    private Integer code;
    private String msg;
    private Object data;

    private RespEntity() {
    }

    private RespEntity(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static RespEntity build() {
        return new RespEntity();
    }

    public static RespEntity error(String msg) {
        return new RespEntity(500, msg, null);
    }

    public static RespEntity error(String msg, Object obj) {
        return new RespEntity(500, msg, obj);
    }

    public static RespEntity ok(String msg) {
        return new RespEntity(200, msg, null);
    }

    public static RespEntity ok(String msg, Object obj) {
        return new RespEntity(200, msg, obj);
    }

    public static RespEntity ok(Object obj) {
        return new RespEntity(200, "success", obj);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
